import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from "@/views/Layout"
import login from "../views/Login/login";

Vue.use(VueRouter)

export const routes = [
  {
    path: '/',
    name: 'index',
    redirect:"/sys/menu",
    component: Layout,
    children:[{
      path: '/sys/menu',
      name: 'home',
      component:()=>import('@/views/home/home')
    },{
      path: '/sys/role',
      name: 'admin',
      component:()=>import('@/views/admin/admin')
    }]
  },
  {
    path: '/user',
    name: 'index',
    component: Layout,
    meta:{
      title:"所有用户管理"
    },
    children:[{
      path: '/user/index',
      name: 'user',
      component:()=> import('@/views/user/user'),
      meta:{
        title:"用户管理",
        icon:"user"
      }
    },{
      path: '/vip/index',
      name: 'vip',
      component:()=> import('@/views/vip/vip'),
      meta:{
        title:"VIP管理",
        icon:"video-camera-solid"
      }
    }]
  },
  {
    path: '/test',
    name: 'test',
    component: Layout,
    children:[{
      path: '/test/index',
      name: 'test',
      component:()=> import('@/views/test'),
      meta:{
        title:"测试页面",
        icon:"video-camera-solid"
      }
    }]
  },
  {
    path:"/login",
    name:"login",
    component: login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
